import request from '@/utils/requests'
// 获取文章分类详情
export const artGetChannelsService = () => {
  return request.get('/my/cate/list')
}
// 添加文章分类
export const artAddChannelService = (data) => {
  return request.post('/my/cate/add', data)
}
// 删除文章分类
export const artDelChannelService = (id) => {
  const url = `/my/cate/del/${id}`
  return request.delete(url)
}
// 更新文章分类
export const artEditChannelService = (data) => {
  return request.put('/my/cate/info', data)
}

// 获取文章列表
export const artGetListService = (params) => {
  return request.get('/my/article/list', {
    params
  })
}
// 新增文章列表
export const artPublishService = (data) => {
  return request.post('/my/article/add', data)
}

// 通过文章id获取文章详情
export const artGetDetailService = (id) => {
  const url = `/my/article/info/${id}`
  return request.get(url)
}

// 更新文章
export const artUpdataService = (data) => {
  // 设置content-type=application/x-www-form-urlencoded
  // request.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
  return request.post('/my/article/info', data)
}

// 删除文章
export const artDeleteService = (id) => {
  const url = `/my/article/del/${id}`
  return request.delete(url)
}
